<html>
<head><meta charset="utf-8"><title>3M hello world · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/3M.20hello.20world.html">3M hello world</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="231060964"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/3M%20hello%20world/near/231060964" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> marmeladema <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/3M.20hello.20world.html#231060964">(Mar 19 2021 at 17:33)</a>:</h4>
<p>Hello!<br>
I just tried <code>cargo new --bin helloworld</code> and  <code>cargo build --release</code> and the resulting binary is 3.2M big<br>
That seems like <em>a lot</em> for a hello world no?</p>



<a name="231061172"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/3M%20hello%20world/near/231061172" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> marmeladema <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/3M.20hello.20world.html#231061172">(Mar 19 2021 at 17:34)</a>:</h4>
<p>It's also 3.2M in debug mode</p>



<a name="231061449"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/3M%20hello%20world/near/231061449" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/3M.20hello.20world.html#231061449">(Mar 19 2021 at 17:36)</a>:</h4>
<p>this has been covered extensively in blogs and on the <a href="http://users.rust-lang.org">users.rust-lang.org</a> form</p>



<a name="231061513"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/3M%20hello%20world/near/231061513" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/3M.20hello.20world.html#231061513">(Mar 19 2021 at 17:36)</a>:</h4>
<p>You can shrink it with LTO or panic=abort</p>



<a name="231061909"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/3M%20hello%20world/near/231061909" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> marmeladema <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/3M.20hello.20world.html#231061909">(Mar 19 2021 at 17:39)</a>:</h4>
<p><span class="user-mention" data-user-id="281739">@oliver</span> do you have a link to share that explains where those 3.2M comes from?</p>



<a name="231061956"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/3M%20hello%20world/near/231061956" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> marmeladema <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/3M.20hello.20world.html#231061956">(Mar 19 2021 at 17:39)</a>:</h4>
<p><span class="user-mention" data-user-id="232545">@Joshua Nelson</span> yeah that shrinks it down to 1.3M</p>



<a name="231062249"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/3M%20hello%20world/near/231062249" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/3M.20hello.20world.html#231062249">(Mar 19 2021 at 17:41)</a>:</h4>
<p><a href="https://www.collabora.com/news-and-blog/blog/2020/04/28/reducing-size-rust-gstreamer-plugin/">https://www.collabora.com/news-and-blog/blog/2020/04/28/reducing-size-rust-gstreamer-plugin/</a></p>



<a name="231062485"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/3M%20hello%20world/near/231062485" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> marmeladema <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/3M.20hello.20world.html#231062485">(Mar 19 2021 at 17:43)</a>:</h4>
<p>Thanks</p>



<a name="231062615"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/3M%20hello%20world/near/231062615" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/3M.20hello.20world.html#231062615">(Mar 19 2021 at 17:44)</a>:</h4>
<p><a href="https://os.phil-opp.com/freestanding-rust-binary/">https://os.phil-opp.com/freestanding-rust-binary/</a></p>



<a name="231062642"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/3M%20hello%20world/near/231062642" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/3M.20hello.20world.html#231062642">(Mar 19 2021 at 17:44)</a>:</h4>
<p><a href="https://github.com/johnthagen/min-sized-rust">https://github.com/johnthagen/min-sized-rust</a></p>



<a name="231062681"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/3M%20hello%20world/near/231062681" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/3M.20hello.20world.html#231062681">(Mar 19 2021 at 17:44)</a>:</h4>
<p><a href="https://users.rust-lang.org/search?q=binary%20size">https://users.rust-lang.org/search?q=binary%20size</a></p>



<a name="231062848"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/3M%20hello%20world/near/231062848" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> marmeladema <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/3M.20hello.20world.html#231062848">(Mar 19 2021 at 17:46)</a>:</h4>
<p>Also would -Zbuild-std help somehow?</p>



<a name="231063048"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/3M%20hello%20world/near/231063048" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> marmeladema <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/3M.20hello.20world.html#231063048">(Mar 19 2021 at 17:47)</a>:</h4>
<p>It's broken right now in nightly though^^</p>



<a name="231064127"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/3M%20hello%20world/near/231064127" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/3M.20hello.20world.html#231064127">(Mar 19 2021 at 17:54)</a>:</h4>
<p>that information is here on Zulip: <a href="#narrow/search/build-std">https://rust-lang.zulipchat.com/#narrow/search/build-std</a></p>



<a name="231064310"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/3M%20hello%20world/near/231064310" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/3M.20hello.20world.html#231064310">(Mar 19 2021 at 17:56)</a>:</h4>
<p>it looks like that is a cargo flag not a compiler flag</p>



<a name="231064448"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/3M%20hello%20world/near/231064448" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> marmeladema <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/3M.20hello.20world.html#231064448">(Mar 19 2021 at 17:57)</a>:</h4>
<p>yeah I know, I am using build-std extensively</p>



<a name="231064495"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/3M%20hello%20world/near/231064495" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/3M.20hello.20world.html#231064495">(Mar 19 2021 at 17:57)</a>:</h4>
<p>so where is the documentation for that feature?</p>



<a name="231064497"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/3M%20hello%20world/near/231064497" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> marmeladema <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/3M.20hello.20world.html#231064497">(Mar 19 2021 at 17:57)</a>:</h4>
<p>But with current nightly you get compiler errors:</p>
<div class="codehilite"><pre><span></span><code>error: duplicate lang item in crate `core`: `RangeTo`.
  |
  = note: the lang item is first defined in crate `core` (which `std` depends on)
  = note: first definition in `core` loaded from /home/adema/code/rust-test/helloworld/target/x86_64-unknown-linux-gnu/release/deps/libcore-7ce2c8099fab6441.rlib, /home/adema/code/rust-test/helloworld/target/x86_64-unknown-linux-gnu/release/deps/libcore-7ce2c8099fab6441.rmeta
  = note: second definition in `core` loaded from /home/adema/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-166dae07beec0398.rlib
</code></pre></div>



<a name="231064591"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/3M%20hello%20world/near/231064591" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> marmeladema <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/3M.20hello.20world.html#231064591">(Mar 19 2021 at 17:58)</a>:</h4>
<p><a href="https://doc.rust-lang.org/cargo/reference/unstable.html#build-std">https://doc.rust-lang.org/cargo/reference/unstable.html#build-std</a></p>



<a name="231064843"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/3M%20hello%20world/near/231064843" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/3M.20hello.20world.html#231064843">(Mar 19 2021 at 18:00)</a>:</h4>
<p><a class="stream" data-stream-id="246057" href="/#narrow/stream/246057-t-cargo">#t-cargo</a> ?</p>



<a name="231065093"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/3M%20hello%20world/near/231065093" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/3M.20hello.20world.html#231065093">(Mar 19 2021 at 18:01)</a>:</h4>
<p>according to the wg github they meet on Discord which may or may-not still be true</p>



<a name="231065174"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/3M%20hello%20world/near/231065174" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> marmeladema <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/3M.20hello.20world.html#231065174">(Mar 19 2021 at 18:01)</a>:</h4>
<p>Hum maybe it's my setup though. With a nightly I <em>know</em> was working before I does not work anymore</p>



<a name="231065336"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/3M%20hello%20world/near/231065336" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> hyd-dev <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/3M.20hello.20world.html#231065336">(Mar 19 2021 at 18:02)</a>:</h4>
<p>This works for me with the latest nightly:</p>
<div class="codehilite" data-code-language="Bash"><pre><span></span><code><span class="nv">CARGO_PROFILE_RELEASE_PANIC</span><span class="o">=</span>abort cargo run --release -Zbuild-std<span class="o">=</span>panic_abort,std --target x86_64-unknown-linux-gnu
</code></pre></div>



<a name="231065688"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/3M%20hello%20world/near/231065688" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/3M.20hello.20world.html#231065688">(Mar 19 2021 at 18:05)</a>:</h4>
<p>in the past [i.e. afiak] <code>cargo build -Zbuild-std=core -Zbuild-std-features=compiler-builtins-mem</code> works</p>



<a name="231065735"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/3M%20hello%20world/near/231065735" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> marmeladema <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/3M.20hello.20world.html#231065735">(Mar 19 2021 at 18:05)</a>:</h4>
<p>It's due to one of the profile.release I added to have a smaller binary. I'll binary search which one</p>



<a name="231065947"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/3M%20hello%20world/near/231065947" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/3M.20hello.20world.html#231065947">(Mar 19 2021 at 18:06)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/pull/77284">https://github.com/rust-lang/rust/pull/77284</a></p>



<a name="231066143"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/3M%20hello%20world/near/231066143" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> marmeladema <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/3M.20hello.20world.html#231066143">(Mar 19 2021 at 18:08)</a>:</h4>
<p>Ok as soon as I add <code>panic = "abort"</code> to my <code>Cargo.toml</code> file, then build-std breaks</p>



<a name="231066158"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/3M%20hello%20world/near/231066158" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> hyd-dev <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/3M.20hello.20world.html#231066158">(Mar 19 2021 at 18:08)</a>:</h4>
<p>You are probably missing <code>panic_abort</code> in <code>-Zbuild-std</code>: <a href="https://github.com/rust-lang/wg-cargo-std-aware/issues/56#issuecomment-654660567">https://github.com/rust-lang/wg-cargo-std-aware/issues/56#issuecomment-654660567</a></p>



<a name="231066199"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/3M%20hello%20world/near/231066199" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> marmeladema <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/3M.20hello.20world.html#231066199">(Mar 19 2021 at 18:08)</a>:</h4>
<p>oh ok</p>



<a name="231066409"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/3M%20hello%20world/near/231066409" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> marmeladema <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/3M.20hello.20world.html#231066409">(Mar 19 2021 at 18:09)</a>:</h4>
<p>Yeah that was it <span aria-label="+1" class="emoji emoji-1f44d" role="img" title="+1">:+1:</span></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>